#include<iostream>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
ll a[55];
ll ans;
ll ans1;
ll n,m;
ll suma[1<<21];
ll sumb[1<<21];
void dfs(int g,int now,ll sum){
    if(g==n/2+1)return;
    if(now==n/2+1){
        return;
    }
    if(sum>=m)return;
    for(int i=now;i<=n/2;i++){
        if(sum+a[i]<=m){
            ans++;
            suma[ans]=sum+a[i];
            dfs(g+1,i+1,sum+a[i]);
        }
    }
}

void dfs1(int g,int now,ll sum){
    if(g==n-n/2)return;
    if(now==n+1){
        return;
    }
    if(sum>=m)return;
    for(int i=now;i<=n;i++){
        if(sum+a[i]<=m){
            ans1++;
            sumb[ans1]=sum+a[i];
            dfs1(g+1,i+1,sum+a[i]);
        }
    }
}
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    dfs(0,1,0);
    dfs1(0,n/2+1,0);
    sort(suma+1,suma+1+ans);
   ll sum=0;
    for(int i=1;i<=ans1;i++){
        sum+=(upper_bound(suma+1,suma+1+ans,m-sumb[i])-suma-1);
    }
    cout<<sum+ans1+ans+1;
    return 0;
}